package mebp;

public class Node {
	
	private final float x;
	private final float y;
	private final int id;
	
	public Node(int id, float x, float y) {
		this.id=id;
		this.x = x;
		this.y = y;
	}
	
	/**
	 * The Index in the input file
	 * @return
	 */
	public int getId() {
		return id;
	}
	
	/**
	 * Long live Pythagoras!
	 * @param n other node
	 * @return cartesian distance to this node
	 */
	public double distanceTo(Node n) {
		float deltaX=this.x-n.x;
		float deltaY=this.y-n.y;
		return Math.sqrt(deltaX*deltaX+deltaY*deltaY);
	}

	public float getX() {
		return x;
	}

	public float getY() {
		return y;
	}

}
